package study.dubbo.springcloud.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.dubbo.api.service.ServerService;
import study.dubbo.springcloud.consumer.support.result.Result;
import study.dubbo.springcloud.consumer.support.result.Results;

import java.util.Map;

@Slf4j
@RestController
public class ServerController {

    @DubboReference
    private ServerService serverService;

    @RequestMapping("/getServerInfo")
    public Result getServerInfo() {
        Map<String, Object> data = serverService.getServerInfo();
        return Results.ok(data);
    }
}
